angular.module('fs.waf').controller('layoutDemoCtrl', [
  '$scope',
  '$translate',
  '$templateCache',
  '$locale',
  'storageService',
  '$uibModal',
  function($scope, $translate, $templateCache, $locale, storageService, $uibModal) {
    this.ngModel = { abc: 'abc' };

    this.fsGridConfig = {
      fsButtons: {
        name: 'buttons',
        label: 'buttons in fsGrid',
        model: 'buttonsValue',
        type: 'buttons',

        // groupClass: '',
        appScope: $scope,
        buttons: [
          {
            name: 'button',
            label: 'button',
            type: 'button', //'button','submit','search','reset' 默认submit
            // btnScope: $scope,
            options: {
              icon: 'setup',
              // showIcon: false, //是否显示图标,默认 true
              callback: {
                click: 'callbackFunc'
              },
              hotKey: 'alt+1'
            }
          },
          {
            name: 'submit',
            label: 'submit',
            type: 'submit', //'button','submit','search','reset' 默认submit
            // btnScope: $scope,
            options: {
              icon: 'setup',
              // showIcon: false, //是否显示图标,默认 true
              callback: {
                click: 'callbackFunc'
              },
              hotKey: 'alt+2'
            }
          },
          {
            name: 'reset',
            label: 'reset',
            type: 'reset', //'button','submit','search','reset' 默认submit
            // btnScope: $scope,
            options: {
              icon: 'setup',
              // showIcon: false, //是否显示图标,默认 true
              callback: {
                click: 'callbackFunc'
              },
              hotKey: 'alt+3'
            }
          },
          {
            name: 'search',
            label: 'search',
            type: 'search', //'button','submit','search','reset' 默认submit
            // btnScope: $scope,
            options: {
              icon: 'setup',
              // showIcon: false, //是否显示图标,默认 true
              callback: {
                click: 'callbackFunc'
              },
              hotKey: 'alt+4'
            }
          }
        ]
      },
      fsLink: {
        active: true,
        show: true,

        type: 'link', //fs-grid 填充的组件类型名
        model: 'linkValue', //和ngModel关联的字段
        appScope: $scope, //绑定页面的$scope

        name: 'link', //
        label: 'link', //组件标题名
        gridClass: 'aaaaa',

        size: 4, //控制组件在页面中所占单元格的长度
        tooltip: 'textarea tooltip', //tooltip 中的提示内容

        options: {
          callback: {
            click: 'callbackFunc'
          }
        }
      }
    };

    this.buttonGroups = {
      buttons: [
        {
          name: 'button',
          label: 'button',
          type: 'button', //'button','submit','search','reset' 默认submit
          // btnScope: $scope,
          options: {
            icon: 'setup',
            // showIcon: false, //是否显示图标,默认 true
            callback: {
              click: 'vm.callbackFunc'
            },
            hotKey: 'alt+1'
          }
        },
        // {
        //   name: 'submit',
        //   label: 'submit',
        //   type: 'submit', //'button','submit','search','reset' 默认submit
        //   // btnScope: $scope,
        //   options: {
        //     icon: 'setup',
        //     // showIcon: false, //是否显示图标,默认 true
        //     callback: {
        //       click: 'callbackFunc'
        //     },
        //     hotKey: 'alt+2'
        //   }
        // },
        // {
        //   name: 'reset',
        //   label: 'reset',
        //   type: 'reset', //'button','submit','search','reset' 默认submit
        //   // btnScope: $scope,
        //   options: {
        //     icon: 'setup',
        //     // showIcon: false, //是否显示图标,默认 true
        //     callback: {
        //       click: 'callbackFunc'
        //     },
        //     hotKey: 'alt+3'
        //   }
        // },
        {
          name: 'search',
          label: 'search',
          type: 'search', //'button','submit','search','reset' 默认submit
          // btnScope: $scope,
          options: {
            icon: 'setup',
            // showIcon: false, //是否显示图标,默认 true
            callback: {
              click: 'callbackFunc'
            },
            hotKey: 'alt+4'
          }
        }
      ]
    };

    this.searchGroups = {
      name: 'Demo',
      gridGroups: [
        {
          grids: [['fsText1'], ['fsText2'], ['fsText3'], ['fsText4']],
          name: 'row1'
        }
        // {
        //   grids: ['fsText', 'fsText', 'fsText'],
        //   name: 'row2'
        // }
      ],
      gridGroupConfigs: {
        row1: {
          name: 'row1',
          title: 'layout demo',
          type: 'search' //'normal':带有标题栏并具有折叠功能 ,'search':没有标题栏,通过search按钮实现折叠功能,'anonymous':没有标题栏,没有折叠伸缩功能
        }
        // row2: {
        //   name: 'row2',
        //   title: 'layout demo',
        //   type: 'normal'
        // }
      },
      gridConfigs: {
        fsText1: {
          name: 'text1',
          label: 'text1',
          size: 3,
          help: 'text',
          inputClass: '',
          type: 'text',
          model: 'textValue',
          appScope: $scope,
          placeholder: 'text',
          tooltip: 'text',
          // tooltipTemplateUrl: '',
          tooltipClass: '',
          tooltipPlacement: 'top-right'
        },
        fsText2: {
          name: 'text1',
          label: 'text2',
          size: 3,
          help: 'text',
          inputClass: '',
          type: 'text',
          model: 'textValue',
          appScope: $scope,
          placeholder: 'text',
          tooltip: 'text',
          // tooltipTemplateUrl: '',
          tooltipClass: '',
          tooltipPlacement: 'top-right'
        },
        fsText3: {
          name: 'text3',
          label: 'text3',
          size: 3,
          help: 'text',
          inputClass: '',
          type: 'text',
          model: 'textValue',
          appScope: $scope,
          placeholder: 'text',
          tooltip: 'text',
          // tooltipTemplateUrl: '',
          tooltipClass: '',
          tooltipPlacement: 'top-right'
        },
        fsText4: {
          name: 'text4',
          label: 'text4',
          size: 3,
          help: 'text',
          inputClass: '',
          type: 'text',
          model: 'textValue',
          appScope: $scope,
          placeholder: 'text',
          tooltip: 'text',
          // tooltipTemplateUrl: '',
          tooltipClass: '',
          tooltipPlacement: 'top-right'
        }
      }
    };

    // TODO: 组件回调页面controller中的方法
    this.callbackFunc = function() {
      console.log(arguments);
    };
  }
]);
